package com.kylin.module.admin.business;

import java.util.List;

import com.kylin.common.dict.orm.Dict;
import com.kylin.common.exception.BusinessException;
import com.kylin.common.util.MemObjFactory;
import com.kylin.hibernate.BaseHibernateDAO;
import com.kylin.module.community.orm.Member;
import com.kylin.module.user.orm.User;

public class ManageMemberBlogic {

	
	/**
	 * 根据userid 删除 会员记录
	 * @param userId 会员关联的用户id
	 * @throws BusinessException
	 */
	public void deleteMemberUserById(Long userId) throws BusinessException {
		User user = (User)BaseHibernateDAO.findById(User.class, userId);
		List list =BaseHibernateDAO.findByProperty(Member.class, "user",user);
		BaseHibernateDAO.delete(user);
		for(int i=0;i<list.size();i++){
		BaseHibernateDAO.delete(list.get(i));
		}
	}

}
